# 如何编译，输入make即可编译，生成.ko 

#ubuntu的内核源码树，如果要编译在ubuntu中安装的模块就打开这2个
#KERN_VER = $(shell uname -r)
#KERN_DIR = /lib/modules/$(KERN_VER)/build	


# 内核开发中，在顶层 Makefile 设置了这2个，
# arm64可以作为Makefile参数传入，传入以后Makefile内部进行判断， arm arm64 mips不同的编译参数
# export ARCH=arm64
# export CROSS_COMPILE=~/work/denganzhi/New/rk3566_3568_sourcecode/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-
# export arm64_gcc=~/work/denganzhi/New/rk3566_3568_sourcecode/prebuilts/gcc/linux-x86/aarch64/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-gcc		
# KERN_DIR = ~/work/denganzhi/New/rk3566_3568_sourcecode/kernel


KERN_DIR = /home/robin/work/kernel-rockchip-nanopi4-linux-v4.4.y

# 文件名
#   把 leds-s5pv210.c 编译为目标 leds-s5pv210.o      obj表示 object   m表示module 
obj-m	+= 01_ft5x06_client.o
obj-m	+= 01_ft5x06_driver.o

# PWD?=$(shell pwd)                     Makefile 路径， 驱动源码路径     等价于  `pwd`

all:
#  命令 make  modules     -C 改变目录到内核源码里面去， M    理解Module   - makefile和源码的路径
	make -C $(KERN_DIR) M=`pwd` modules
#	make -C $(KERN_DIR) M=`pwd` modules 
#	arm-none-linux-gnueabi-gcc app.c -o app.o
#   $(arm64_gcc) -o 04_app.o 04_app.c -static



.PHONY: clean
clean:
	make -C $(KERN_DIR) M=`pwd` modules clean
#	rm -rf *.o  *.ko *.mod.o *.mod.c *.symvers *.order a.out .*.*.cmd  .*.*.mod  *.*.d  *.mod

